from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
from polls.models import  User
import random
import json

def index(request):
    return HttpResponse("Hello, world. You're at the polls index.")



def addUser(request):
    user=User()
    user.id=random.randint(1,100)
    user.name="王"+str(random.randint(1,100))
    user.pwd="123456"

    user.save()

    
    u=User.objects.all()

    #return HttpResponse(json.dumps(u))
    return render(request, "list.html", context={"persons":u})

  
